<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据字典</title>
<link href="../css/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">

	$(function(){			
						$.post('../allTypeDDL.action',{},function(data){
							$('#typeid').html('');
								for(var i=0;i<data.length;i++){
									$('#typeid').append('<option value="'+data[i].type+'">'+data[i].type+'</option>');
								}
								loadType();
							},'json');	
							
						$('#typeid').change(function(){
							loadType();	
						});	
	});

	function _del(obj) {
		$.get('../delDDL.action', {
			'ddl.typeId' : obj
		}, function(data) {
			if (data == '1') {
				alert("删除成功！");
			}

		});
	}
	
	function loadType(){
		$("#tb").html('');
		var type = $('#typeid').val();
		$.post("../byTypeDDL.action",{"ddl.typeType":type},function(result){
								for ( var i = 0; i < result.length; i++) {
													$("#tb").append('<tr><td>'
															+(i+1)
														    +'</td><td>'
															+ result[i].key
															+ '</td><td>'
															+ result[i].value
															+ '</td><td><a href=delDDL.action?ddl.typeId='
															+ result[i].id
															+ '> <img src="../img/del.gif"  title="删除" align="absmiddle" /></a>&nbsp;<a href=../getDDL.action?ddl.typeId='+result[i].id+'><img src="../img/edit.gif"  title="修改" align="absmiddle" /></a></td></tr>');
												}
							},'json');	
	}
	
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">

	<thead>
        <tr>
          <td height="23" colspan="4" align="center" valign="middle">字典类型：
            <label for="typeid"></label>
            <select name="typeid" id="typeid">
          </select>
          	&nbsp;&nbsp;<a href="add.html">新增</a>
          </td>
        </tr>
     
        <tr>
          <td width="45">序号</td>
          <td width="55">key</td>
          <td>value</td>
          <td width="115">操作</td>
        </tr>
    </thead>
    <tbody id="tb">
        <tr align="center" valign="middle">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td> </td>
        </tr>
    </tbody>
  </table>
</body>
</html>
